package ex.app.system.action;

import com.fzy.core.acegi.UserDetailsImpl;
import com.fzy.core.webwork.BaseAction;
import com.opensymphony.xwork.Preparable;

import ex.app.system.service.LoginService;

public class InSideLoginAction extends BaseAction implements Preparable {
	
	String grpCode;
	String loginName;
	String passWord;
	LoginService loginService;
	
	
	public String execute() throws Exception {	
		UserDetailsImpl u = loginService.getInsideUser(getGrpCode(),getLoginName());
		if(u == null){			
			return "dispatcher:inside_login.jsp?error=1";
		}else{
			String username=u.getUsername();
			return "redirect:/j_acegi_security_check?j_username="+username+"&j_password="+getPassWord()+"&j_userflag=0";
		}
	}	

	public void prepare() throws Exception {

	}

	public String getGrpCode() {
		return grpCode;
	}

	public void setGrpCode(String grpCode) {
		this.grpCode = grpCode;
	}

	public String getLoginName() {
		return loginName;
	}

	public void setLoginName(String loginName) {
		this.loginName = loginName;
	}

	public String getPassWord() {
		return passWord;
	}

	public void setPassWord(String passWord) {
		this.passWord = passWord;
	}

	public LoginService getLoginService() {
		return loginService;
	}

	public void setLoginService(LoginService loginService) {
		this.loginService = loginService;
	}	
}
